import type { ProcessDefinitionInOrUpReq, PublishProcessDefinitionXmlReq, QueryOneProcessDefinitionReq, QueryProcessDefinitionReq, SaveProcessDefinitionXmlReq } from './processDefinitionType'
import request from '@/utils/http/request'

// 保存流程定义
export function saveProcessDefinition(data: ProcessDefinitionInOrUpReq) {
  return request.post<any>({
    url: '/pm-process/api/v1/definition/save',
    data,
  })
}

// 分页查询流程定义列表
export function pageProcessDefinition(data: QueryProcessDefinitionReq) {
  return request.post<any>({
    url: '/pm-process/api/v1/definition/page',
    data,
  })
}

// 查询流程定义 xml
export function getProcessDefinitionXml(data: QueryOneProcessDefinitionReq) {
  return request.post<any>({
    url: '/pm-process/api/v1/definition/getProcessDefinitionXml',
    data,
  })
}

// 保存流程定义 xml
export function saveProcessDefinitionXml(data: SaveProcessDefinitionXmlReq) {
  return request.post<any>({
    url: '/pm-process/api/v1/definition/saveProcessDefinitionXml',
    data,
  })
}

// 发布流程定义 xml
export function publishProcessDefinition(data: PublishProcessDefinitionXmlReq) {
  return request.post<any>({
    url: '/pm-process/api/v1/definition/deployProcessDefinitionXml',
    data,
  })
}
